﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;

namespace AKMII.DMRA.Web.Controls
{
    public partial class InputAgentDiv : System.Web.UI.UserControl
    {
        public EventHandler OnOkClick;
        public EventHandler OnCancelClick;

        public void SetVisibleForAgent(bool isVisible1, bool isVisible2, string text1, string text2)
        {
            lblDivMkt1.Visible = isVisible1;
            txtDivMkt1.Visible = isVisible1;
            lblDivMkt2.Visible = isVisible2;
            txtDivMkt2.Visible = isVisible2;

            lblDivMkt1.Text += text1;
            lblDivMkt2.Text += text2;
        }

        public string GetAgentText()
        {
            string agents = string.Empty;

            if (lblDivMkt1.Visible)
            {
                agents += lblDivMkt1.Text.Replace("Agents of Div/Mkt ", string.Empty) + "," + txtDivMkt1.Text;
            }
            if (lblDivMkt2.Visible)
            {
                agents += ";" + lblDivMkt2.Text.Replace("Agents of Div/Mkt ", string.Empty) + "," + txtDivMkt2.Text;
            }

            return agents;
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (OnOkClick != null)
            {
                OnOkClick(sender, e);
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            if (OnCancelClick != null)
            {
                OnCancelClick(sender, e);
            }
        }
    }
}